package cate.common.table.activity.turntable.sheet;

import cate.common.table.ESheet;
import cate.common.table.activity.turntable.row.TurnTableFloorRewardRow;

import java.util.ArrayList;
import java.util.List;

public class TurnTableFloorRewardSheet extends ESheet<TurnTableFloorRewardRow> {
    @Override
    public String getSheetName() {
        return "保底奖励配置";
    }

    public TurnTableFloorRewardRow getRowByLevel(int configId, int level) {
        for (TurnTableFloorRewardRow row :
                list) {
            if (row.configId == configId && row.level == level) {
                return row;
            }
        }
        return null;
    }

    public TurnTableFloorRewardRow getMaxLevelRow(int configId) {
        TurnTableFloorRewardRow res = null;
        for (TurnTableFloorRewardRow row :
                list) {
            if (row.configId == configId && (res == null || res.level < row.level)) {
                res = row;
            }
        }
        return res;
    }

    public List<TurnTableFloorRewardRow> getRowByLuckyValue(int configId,int luckyValue) {
        List<TurnTableFloorRewardRow> res = new ArrayList<>();
        for (TurnTableFloorRewardRow row : list) {
            if (row.configId == configId && row.luckyValue <= luckyValue) {
                res.add(row);
            }
        }
        return res;
    }
}
